package com.xteam.xnetworkdisk.sys.controller;

import java.util.Arrays;
import java.util.Map;

import com.xteam.xnetworkdisk.utils.R;
import com.xteam.xnetworkdisk.vo.SaveContactsVO;
import com.xteam.xnetworkdisk.vo.UpdateContactsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.xteam.xnetworkdisk.sys.entity.ContactsEntity;
import com.xteam.xnetworkdisk.sys.service.ContactsService;




/**
 * 
 *
 * @author xiaozhiyong
 * @email xiaozhiyong03@gmail.com
 * @date 2024-08-22 16:28:29
 */
@RestController
@RequestMapping("sys/contacts")
public class ContactsController {
    @Autowired
    private ContactsService contactsService;

    /**
     * 获取联系人列表
     * @return
     */
    @GetMapping("/contactsList")
    public R contactsList(){
		R result = contactsService.contactsList();
        return result;
    }

    /**
     * 新增联系人详情
     * @param saveContactsVO
     * @return
     */
    @PostMapping("/save")
    public R save(@RequestBody SaveContactsVO saveContactsVO){
        R result = contactsService.save(saveContactsVO);
        return result;
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public R update(@RequestBody UpdateContactsVO updateContactsVO){
        R result = contactsService.update(updateContactsVO);
        return result;
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    public R delete(@RequestBody Integer[] contactsIds){
        contactsService.removeByIds(Arrays.asList(contactsIds));
        return R.ok();
    }
}
